package com.soulgame.sms.pay.vo;

import com.soul.sdk.utils.PayUtils;
import com.soul.sdk.utils.json.KJSONObject;

/**
 * @author lch
 * @version Create time：2017-3-24
 * @类说明：
 */
public class VoWoShopPayParams extends VoPayParams {

	public VoWoShopPayParams(KJSONObject pSdkParamsJSON) {
		super(pSdkParamsJSON);
	}

	/**
	 * 获取计费点，缺省返回 0
	 * 
	 * @param pProductId
	 * @return
	 */
	public String getPayCode(String pProductId) {
		return super.getPayCode(pProductId, "woshop");
	}

	/**
	 * 获取MonthType，缺省返回 0
	 * 
	 * @param pProductId
	 * @return
	 */
	public String getMonthType(String pProductId) {
		String monthType = "0";
		KJSONObject woShopJSON = getWoShopJson(pProductId);
		if (woShopJSON != null) {
			monthType = woShopJSON.getString("monthType", "0");
		}
		return monthType;
	}

	public String getServiceId(String pProductId) {
		String serviceId = "0";
		KJSONObject woShopJSON = getWoShopJson(pProductId);
		if (woShopJSON != null) {
			serviceId = woShopJSON.getString("serviceId", "0");
		}
		return serviceId;
	}

	private KJSONObject getWoShopJson(String pProductId) {
		KJSONObject aDataJSON = null;
		if (mPayDataJSON != null) {
			KJSONObject productDataJSON = mPayDataJSON.getJSONObject(pProductId);
			if (productDataJSON != null) {
				aDataJSON = productDataJSON.getJSONObject("woshop");
			}
		}
		return aDataJSON;
	}

}
